<div class="section" id="sitemaplist">
	<form action="" name="formlist" id="formlist" method="post">
	<div class="section-title">
		BUSSINESS RESULT
		  <div class="button right">
			<input class="button" type="button" name="print" value="<?php echo $this->document->text['text_printthislist']?>" onclick="printlist()"/>  
			<input class="button" type="button" name="close" value="<?php echo $this->document->text['button_close']?>" onclick="window.close()"/>  
			<input type="hidden" name="display" id="display" value="" />
		</div>
		<div class="clearer">&nbsp;</div>
	</div>
    
    <div class="section-content">
    	<div>
			<b><?php echo $this->document->text['text_datefrom']?> : </b><input type="text" class="text" size="10" name="search_fromdate" id="search_fromdate" value="<?php echo $search_fromdate?>"  /><b><?php echo $this->document->text['text_to']?></b><input type="text" class="text" size="10" name="search_todate" id="search_todate" value="<?php echo $search_todate?>"  />
			<input class="button" value="<?php echo $this->document->text['button_search']?>" type="submit">
		</div>
            <div class="sitemap treeindex" style="width:1000px">
                <table class="data-table" cellpadding="0" cellspacing="0">
                <tbody>
                    <tr class="tr-head">
						<th width="50px">No.</th>
                        <th width="400px"><?php echo $this->document->text['text_accounttype']?></th>
						<th width="100px">Value</th>
                    </tr>
        
   
				
		<?php foreach($reports as $key => $type) {?>
			<tr style="background-color:#f3f3f3">
				<td colspan="3" style="font-weight:bold; font-weight:1.2em; background-color:#f3f3f3"><?php echo $key?></td>
			</tr>		
				
				
        <?php
			$index = 0;
			$total = 0;
            foreach($type['items'] as $item)
            {
				$index += 1;
				$total += $item['sumtotal'];
        ?>
                    <tr>
                        <td><?php echo $index?></td>
						<td><?php echo $accounttype[$item['vouchergroup']]?></td>
						<td calc="calc" style="text-align:right"><?php echo $item['sumtotal']?></td>
                    </tr>
        <?php
            }
        ?>
		
				<tr>
					<td colspan="2" style="text-align:right; font-weight:bold; font-size:1.2em;background-color:#f3f3f3">Total: </td>
					<td class="calc" style="text-align:right; font-weight:bold; font-size:1.2em; background-color:#f3f3f3"><?php echo $total?></td>
				</tr>
		
					
			<?php } ?>					
                        
                                                    
                </tbody>
                </table>
            </div>
        
        
        </form>
        
    </div>
    
</div>
<script language="javascript">
$(function() {
		$("#search_fromdate").datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'dd/mm/yy'
				});
		
		
		$("#search_todate").datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'dd/mm/yy'
				});		
		
		$(".calc").each(function(){
			num = formateNumber($(this).html().replace(/,/g,""));
			$(this).html(num);
		});
		
		$('.orderlink').popupWindow({ 
			height:600, 
			width:1020, 
			centerScreen:1,
			scrollbars: 1,
			resizable : 1,
			status: 0,
			location: 0
		});
		
});
		
		

function deleteList1()   
{
	$.post("?route=voucher/search/deleteorder", 
			$("#formlist").serialize(), 
			function(data)
			{
				if(data!="")
				{
					alert(data)
					linkto("?<?php echo $refres?>")
				}
			}
	);
}

function printlist()   
{
	$("#display").val("report");
	$("#formlist").attr("target","_self");
	$("#formlist").submit();
	$("#display").val("report");
	$("#formlist").attr("target","");
}

</script>
